// services/mockDataApi.js
// 模拟数据 API 服务
export const mockDataApi = {
  // 获取数据
  getChartData: (filters = {}) => {
    return new Promise((resolve) => {
      setTimeout(() => {
        // 模拟不同的数据格式
        const dataSets = {
          default: {
            categories: ['产品A', '产品B', '产品C', '产品D', '产品E'],
            sales: [120, 200, 150, 80, 70],
            profit: [60, 120, 100, 40, 35],
            total: 12345,
            growth: 12.5
          },
          sales: {
            months: ['1月', '2月', '3月', '4月', '5月', '6月'],
            revenue: [32000, 28000, 45000, 38000, 52000, 41000],
            profit: [12000, 10000, 18000, 15000, 22000, 16000],
            totalSales: 198000,
            avgRevenue: 33000,
            growthRate: 8.3
          },
          users: {
            days: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
            activeUsers: [1200, 1800, 1500, 2000, 2200, 2500, 2300],
            newUsers: [120, 150, 130, 180, 200, 220, 210],
            totalUsers: 14500,
            dailyAvg: 2071,
            retention: 85.5
          }
        }

        const dataType = filters.dataType || 'default'
        const data = dataSets[dataType] || dataSets.default

        resolve({
          success: true,
          data: data,
          message: '数据获取成功'
        })
      }, 800)
    })
  }
}